#include "sdkGlobal.h"
#include "platform_global.h"
#include "platform_margin.h"
#include "CONFIG.h"

#if SUPPORT_MARGIN

typedef struct
{
    ShowMarginViewFunc mShowMarginViewFunc;
    ShowHasMarginViewFunc mShowHasMarginViewFunc;
    GetMarginStatusFunc mGetMarginStatusFunc;
    TransmitMarginOnlineFunc mTransmitOnlineFunc;
    TransShowPlatformFunc mTransShowFunc;
    RecordPlatformFunc mRecordPlatformFunc;
    TransmitDataPlatformFunc mTransmitDataPlatformFunc;
    TransmitMarginSaleOnlineFunc mTransmitMarginSaleOnlineFunc;
} platform_margin_entity;

static platform_margin_entity g_platform_margin_entity;

void platform_margin_init()
{
    memset(&g_platform_margin_entity, 0x00, sizeof(platform_margin_entity));
}

void platform_margin_set_show_margin_view_func(ShowMarginViewFunc func)
{
    g_platform_margin_entity.mShowMarginViewFunc = func;
}

ShowMarginViewFunc platform_margin_get_show_margin_view_func()
{
    return g_platform_margin_entity.mShowMarginViewFunc;
}

void platform_margin_set_show_has_margin_view_func(ShowHasMarginViewFunc func)
{
    g_platform_margin_entity.mShowHasMarginViewFunc = func;
}

ShowHasMarginViewFunc platform_margin_get_show_has_margin_view_func()
{
    return g_platform_margin_entity.mShowHasMarginViewFunc;
}

void platform_margin_set_get_margin_status_func(GetMarginStatusFunc func)
{
    g_platform_margin_entity.mGetMarginStatusFunc = func;
}

GetMarginStatusFunc platform_margin_get_margin_status_func()
{
    return g_platform_margin_entity.mGetMarginStatusFunc;
}

void platform_margin_set_transmit_online_func(TransmitMarginOnlineFunc func)
{
    g_platform_margin_entity.mTransmitOnlineFunc = func;
}

TransmitMarginOnlineFunc platform_margin_get_transmit_online_func()
{
    return g_platform_margin_entity.mTransmitOnlineFunc;
}

void platform_margin_set_show_func(TransShowPlatformFunc *flowFunc)
{
    memcpy(&g_platform_margin_entity.mTransShowFunc, flowFunc, sizeof(TransShowPlatformFunc));
}

TransShowPlatformFunc *platform_margin_get_show_func()
{
    return &g_platform_margin_entity.mTransShowFunc;
}

void platform_margin_set_transmit_data_func(TransmitDataPlatformFunc *platformFunc)
{
    memcpy(&g_platform_margin_entity.mTransmitDataPlatformFunc, platformFunc, sizeof(TransmitDataPlatformFunc));
}

TransmitDataPlatformFunc *platform_margin_get_transmit_data_func()
{
    return &g_platform_margin_entity.mTransmitDataPlatformFunc;
}

void platform_margin_set_record_func(RecordPlatformFunc *platformFunc)
{
    memcpy(&g_platform_margin_entity.mRecordPlatformFunc, platformFunc, sizeof(RecordPlatformFunc));
}

RecordPlatformFunc *platform_margin_get_record_func()
{
    return &g_platform_margin_entity.mRecordPlatformFunc;
}

void platform_margin_sale_set_transmit_online_func(TransmitMarginSaleOnlineFunc func)
{
    g_platform_margin_entity.mTransmitMarginSaleOnlineFunc = func;
}

TransmitMarginSaleOnlineFunc platform_margin_sale_get_transmit_online_func()
{
    return g_platform_margin_entity.mTransmitMarginSaleOnlineFunc;
}


#endif